﻿#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLuaBase.lua_CSFunction;
#endif

using XLua;
using System.Collections.Generic;


namespace XLua.CSObjectWrap
{
    using Utils = XLua.Utils;
    public class YoozooMarsGotEventSystemWrap 
    {
        public static void __Register(RealStatePtr L)
        {
			ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
			System.Type type = typeof(Yoozoo.Mars.Got.EventSystem);
			Utils.BeginObjectRegister(type, L, translator, 0, 7, 0, 0);
			
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "Dump", _m_Dump);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddEvent", _m_AddEvent);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "RemoveEvent", _m_RemoveEvent);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "AddIntEvent", _m_AddIntEvent);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "RemoveIntEvent", _m_RemoveIntEvent);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "TriggerEvent", _m_TriggerEvent);
			Utils.RegisterFunc(L, Utils.METHOD_IDX, "TriggerEventByLua", _m_TriggerEventByLua);
			
			
			
			
			
			Utils.EndObjectRegister(type, L, translator, null, null,
			    null, null, null);

		    Utils.BeginClassRegister(type, L, __CreateInstance, 1, 1, 1);
			
			
            
			Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "ALL_EVENT_COUNTER", _g_get_ALL_EVENT_COUNTER);
            
			Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "ALL_EVENT_COUNTER", _s_set_ALL_EVENT_COUNTER);
            
			
            Utils.RegisterFunc(L, Utils.CLS_IDX, "New", __CreateInstanceNew);
			Utils.EndClassRegister(type, L, translator);
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstance(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 1)
				{
					
					var gen_ret = new Yoozoo.Mars.Got.EventSystem();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to Yoozoo.Mars.Got.EventSystem constructor!");
            
        }

        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int __CreateInstanceNew(RealStatePtr L)
        {
            
			try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
				if(LuaAPI.lua_gettop(L) == 0)
				{
					
					var gen_ret = new Yoozoo.Mars.Got.EventSystem();
					translator.Push(L, gen_ret);
                    
					return 1;
				}
				
			}
			catch(System.Exception gen_e) {
				return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
			}
            return LuaAPI.luaL_error(L, "invalid arguments to Yoozoo.Mars.Got.EventSystem constructor!");
            
        }

        
		
        
		
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_Dump(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Mars.Got.EventSystem gen_to_be_invoked = (Yoozoo.Mars.Got.EventSystem)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    
                    gen_to_be_invoked.Dump(  );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_AddEvent(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Mars.Got.EventSystem gen_to_be_invoked = (Yoozoo.Mars.Got.EventSystem)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    int _evtName = LuaAPI.xlua_tointeger(L, 2);
                    System.Action _evt = translator.GetDelegate<System.Action>(L, 3);
                    
                    gen_to_be_invoked.AddEvent( _evtName, _evt );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_RemoveEvent(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Mars.Got.EventSystem gen_to_be_invoked = (Yoozoo.Mars.Got.EventSystem)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    int _evtName = LuaAPI.xlua_tointeger(L, 2);
                    System.Action _evt = translator.GetDelegate<System.Action>(L, 3);
                    
                    gen_to_be_invoked.RemoveEvent( _evtName, _evt );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_AddIntEvent(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Mars.Got.EventSystem gen_to_be_invoked = (Yoozoo.Mars.Got.EventSystem)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    int _evtName = LuaAPI.xlua_tointeger(L, 2);
                    System.Action<int> _evt = translator.GetDelegate<System.Action<int>>(L, 3);
                    
                    gen_to_be_invoked.AddIntEvent( _evtName, _evt );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_RemoveIntEvent(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Mars.Got.EventSystem gen_to_be_invoked = (Yoozoo.Mars.Got.EventSystem)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    int _evtName = LuaAPI.xlua_tointeger(L, 2);
                    System.Action<int> _evt = translator.GetDelegate<System.Action<int>>(L, 3);
                    
                    gen_to_be_invoked.RemoveIntEvent( _evtName, _evt );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_TriggerEvent(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Mars.Got.EventSystem gen_to_be_invoked = (Yoozoo.Mars.Got.EventSystem)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    int _evtName = LuaAPI.xlua_tointeger(L, 2);
                    
                    gen_to_be_invoked.TriggerEvent( _evtName );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _m_TriggerEventByLua(RealStatePtr L)
        {
		    try {
            
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
            
            
                Yoozoo.Mars.Got.EventSystem gen_to_be_invoked = (Yoozoo.Mars.Got.EventSystem)translator.FastGetCSObj(L, 1);
            
            
                
                {
                    int _evtName = LuaAPI.xlua_tointeger(L, 2);
                    XLua.LuaTable _V1 = (XLua.LuaTable)translator.GetObject(L, 3, typeof(XLua.LuaTable));
                    
                    gen_to_be_invoked.TriggerEventByLua( _evtName, _V1 );
                    
                    
                    
                    return 0;
                }
                
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            
        }
        
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _g_get_ALL_EVENT_COUNTER(RealStatePtr L)
        {
		    try {
            
			    LuaAPI.xlua_pushinteger(L, Yoozoo.Mars.Got.EventSystem.ALL_EVENT_COUNTER);
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 1;
        }
        
        
        
        [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
        static int _s_set_ALL_EVENT_COUNTER(RealStatePtr L)
        {
		    try {
                
			    Yoozoo.Mars.Got.EventSystem.ALL_EVENT_COUNTER = LuaAPI.xlua_tointeger(L, 1);
            
            } catch(System.Exception gen_e) {
                return LuaAPI.luaL_error(L, $"c# exception: {gen_e}\n{Yoozoo.Framework.Managers.LuaManager.GetTraceBack()}");
            }
            return 0;
        }
        
		
		
		
		
    }
}
